package topo.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CheckIPUtil {
    public static final String IP_PATTERN = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)";

    public static boolean checkIP(String ip) {
        boolean result = false;
        Pattern pattern = Pattern.compile("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)");
        Matcher matcher = pattern.matcher(ip);
        if (matcher.matches()) {
            result = true;
        }
        return result;
    }
}